﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using TFXK.BLL;
using TFXK.Common;
using log4net;
using TFXK.Model;

public partial class HotelMain : System.Web.UI.MasterPage
{
    private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    private static readonly CategoryBLL bllCategory = new CategoryBLL();
    private static readonly NewsBLL bllNews = new NewsBLL();
    private static readonly HotelBLL bllHotel = new HotelBLL();
    private static readonly TravelLinesBLL bllTravelLines = new TravelLinesBLL();
    int rowCount = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                BindTJ();
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
        }
    }
    //推荐
    public void BindTJ()
    {
        rptHotelType.DataSource = bllCategory.GetNextNodeByCode("hotel_zt");
        rptHotelType.DataBind();

        this.rptHotelTJList.DataSource = bllHotel.GetList("isTJ=1");
        rptHotelTJList.DataBind();

        DataSet ds = bllCategory.GetNextNodeByCode("hotel_city");
        rptAllCity.DataSource = ds;
        rptAllCity.DataBind();
        if (ds != null && ds.Tables[0] != null)
        {
            while (ds.Tables[0].Rows.Count > 8)
            {
                ds.Tables[0].Rows.RemoveAt(8);
            }
            rptHotCity.DataSource = ds;
            rptHotCity.DataBind();
        }
    }

    public string SetStarWidth(object obj)
    {
        try
        {
            int num = int.Parse(obj + "");
            return num * 12 + "";
        }
        catch
        {
            return "0";
        }
    }
    protected void btnSearch_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("HotelList.aspx?SKey=" + txtSKey.Text, false);
    }
}
